<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .error{
            color: red;
        }
    </style>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
    integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>

<div class="container">

    <div class="row">
        <div class="col-md-6 col-lg-offset-3">

            {#<h3>简单form</h3>#}
            {##}
            {##}
            {#<form action="" method="post" novalidate>#}
            {#    {% csrf_token %}#}
            {#    <p>用户名<input type="text" name="name"></p>#}
            {#    <p>密码 <input type="text" name="pwd"></p>#}
            {#    <p>确认密码 <input type="text" name="r_pwd"></p>#}
            {#    <p>邮箱  <input type="text" name="email"></p>#}
            {#    <p>手机号 <input type="text" name="tel"></p>#}
            {#    <input type="submit">#}
            {##}
            {#</form>#}

            <hr>
            <h3>forms组件渲染方式1</h3>
            <form action="" method="post" novalidate>

                {% csrf_token %}
                <p>{{ form.name.label }}
                    {{ form.name }} <span class="pull-right error">{{ form.name.errors.0 }}</span>
                </p>
                <p>{{ form.pwd.label }}
                    {{ form.pwd }} <span class="pull-right error">{{ form.pwd.errors.0 }}</span>
                </p>
                <p>确认密码
                    {{ form.r_pwd }} <span class="pull-right error">{{ form.r_pwd.errors.0 }}</span><span class="pull-right error">{{ errors.0 }}</span>
                </p>
                <p>邮箱 {{ form.email }} <span class="pull-right error">{{ form.email.errors.0 }}</span></p>
                <p>手机号 {{ form.tel }} <span class="pull-right error">{{ form.tel.errors.0 }}</span></p>
                <input type="submit">

            </form>

            {#<h3>forms组件渲染方式2</h3>#}
            {##}
            {#<form action="" method="post" novalidate>#}
            {#     {% csrf_token %}#}
            {##}
            {#    {% for field in form %}#}
            {##}
            {#        <div>#}
            {#            <label for="">{{ field.label }}</label>#}
            {#            {{ field }}#}
            {#        </div>#}
            {##}
            {#    {% endfor %}#}
            {##}
            {#     <input type="submit">#}
            {#</form>#}
            {##}
            {#<h3>forms组件渲染方式3</h3>#}
            {##}
            {#<form action="" method="post">#}
            {#     {% csrf_token %}#}
            {##}
            {#     {{ form.as_p }}#}
            {##}
            {#     <input type="submit">#}
            {#</form>#}


        </div>
    </div>
</div>

</body>
</html>


